"use strict";
cc._RF.push(module, '57e5ackELJD4IFRj10dteKl', 'o1DrawInterface');
// scripts/O1ModuleRes/control/o1DrawBoard/o1DrawInterface.ts

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DrawBase = void 0;
var gameEngine_1 = require("../../../engines/gameEngine");
var DrawBase = /** @class */ (function () {
    function DrawBase() {
    }
    return DrawBase;
}());
exports.DrawBase = DrawBase;
var o1DrawInterface = /** @class */ (function () {
    //
    function o1DrawInterface() {
        this.m_BASE_DATA_KEY = 'o1-draw-data';
        this.m_baseInfo = null;
    }
    o1DrawInterface.prototype.getData = function (name) {
        return this.m_baseInfo[name];
    };
    //
    o1DrawInterface.prototype.OnLoadData = function () {
        this.m_baseInfo = new DrawBase();
        var data = gameEngine_1.default.getServices().localStorageSrv.getStorage(this.m_BASE_DATA_KEY);
        if (data) {
            var result = JSON.parse(data);
            for (var _i = 0, result_1 = result; _i < result_1.length; _i++) {
                var info = result_1[_i];
                this.m_baseInfo[info.name] = info;
            }
        }
    };
    o1DrawInterface.prototype.AddAndWriteDrawData = function (data) {
        //已经存在
        this.m_baseInfo[data.name] = data;
        this.WriteData();
    };
    o1DrawInterface.prototype.DeleteData = function (name) {
        this.m_baseInfo[name] && delete this.m_baseInfo[name];
        this.WriteData();
    };
    o1DrawInterface.prototype.getAllData = function () {
        return this.m_baseInfo;
    };
    o1DrawInterface.prototype.WriteData = function () {
        //
        var ary = [];
        for (var key in this.m_baseInfo) {
            var info = this.m_baseInfo[key];
            ary.push(info);
        }
        gameEngine_1.default.getServices().localStorageSrv.setStorage(this.m_BASE_DATA_KEY, JSON.stringify(ary));
    };
    return o1DrawInterface;
}());
exports.default = o1DrawInterface;

cc._RF.pop();